package homework1.presentation; 

/* User */
import homework1.model.IGradingStrategy;
import homework1.model.NormalGradingStrategy;

/* Java */
import java.util.ArrayList;

/** Very simple facade controller that can be altered for different outputs. 
*/
class Controller 
{
	/** Demo a A student */
	public void AStudent()
	{
		System.out.println("A Student:");
		studentSpec(4);
	}

	/** Demo a B student */
	public void BStudent()
	{
		System.out.println("B Student:");
		studentSpec(2);
	}

	/** Demo a C student */
	public void CStudent()
	{
		System.out.println("C Student:");
		studentSpec(1);
	}

	/** Demo a D student */
	public void DStudent()
	{
		System.out.println("D Student:");
		studentSpec(0);
	}

	/** Demo a FM student */
	public void FMStudent()
	{
		System.out.println("FM Student:");
		studentSpec(7);
	}

	/** Logic for generation of grades trough input.  
	@param specification is the specific case of student...*/
	private void studentSpec(int specification)
	{
		int i;
		IGradingStrategy<Integer> gs = (IGradingStrategy<Integer>) new NormalGradingStrategy();
		Integer exam_grade;
		ArrayList<Integer> components = new ArrayList<Integer>();
		
		for (i=0; i<specification+1; ++i)
		{
		   components.add(10);
		}
		
		exam_grade = new Integer(10+specification*10);
		
		System.out.println("Grade : " + gs.generate_grading(exam_grade, components));

		components.clear(); 
	}
}

